package gui.gui2d.highLevelPanels;

import java.awt.BorderLayout;
import java.awt.Color;

import java.awt.Font;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.text.DefaultCaret;



public class HistoryMovedPanel extends JPanel{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	JScrollPane jsp;
	JTextArea jta;
	
	public HistoryMovedPanel() {
		this.setLayout(new BorderLayout());
		this.setOpaque(false);
		jta= new JTextArea();
		jta.setOpaque(false);
		jta.setEditable(false);
		jta.setForeground(Color.WHITE);
		String carattere = "TimesRoman";
		int plain = Font.ITALIC;
		int dimensioni = 24;
		Font font = new Font(carattere, plain, dimensioni);
		jta.setFont(font);
		jsp=new JScrollPane(jta);
		jsp.setAutoscrolls(true);
		jsp.setOpaque(false);
		jsp.getViewport().setOpaque(false);
		jsp.setBorder(null);
		jsp.getVerticalScrollBar().setOpaque(false);

		DefaultCaret caret = (DefaultCaret)jta.getCaret();
		caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);	
		this.add(jsp,BorderLayout.CENTER);
	}
	
	public void putMove(JLabel jtf){
		String text=jtf.getText();
		
		if(text.charAt(0)=='N'){
			text="   "+text;
		}
		jta.append(text+"\n");
	}
	
}
